<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="s" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="f" uri="http://www.springframework.org/tags/form"%>
<html>
<body>
	<h1>Companies</h1>
	<a href="add">Add</a>
	<table>
		<tr>
			<td>
				<c:choose>
					<c:when test="${sortColumn=='nameSort' && sortDirection=='ASC'}"><a href="list?sortColumn=nameSort&sortDirection=DESC"/>Name</a></c:when>
					<c:otherwise><a href="list?sortColumn=nameSort&sortDirection=ASC"/>Name</a></c:otherwise>
				</c:choose>
			</td>
			<td>Actions</td>
		</tr>
		<c:forEach var="company" items="${page.content}">
		<tr>
			<td>
				<a href="view?id=${company.id}"><c:out value="${company.name}"/></a>
			</td>
			<td>
				<a href="edit?id=${company.id}">edit</a>
			</td>
		</tr>
		</c:forEach>
	</table>
	<c:forEach var="pageCounter" begin="1" end="${page.totalPages}">
		<a href="list?pageNo=${pageCounter-1}&sortColumn=${sortColumn}&sortDirection=${sortDirection}"/>${pageCounter}</a>
	</c:forEach>
</body>
</html>